

<body class="iframe">
    <div class="userlist">
        <div class="frame-header">
            <h2><i class="layui-icon">&#xe705;</i>发件管理</h2>
        </div>
        <h4 class="layui-bg-dark frame-title"><i class="layui-icon">&#xe65f;</i>发件人列表</h4>
        <div class="toolbox layui-form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label" style="margin-top: 16px;width: 40px">清空</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <button class="layui-btn layui-btn-danger clean-today"><i class="layui-icon">&#xe640;</i>今日</button>
                    </div>
                    <div class="layui-input-inline" style="width: 100px;">
                        <button class="layui-btn layui-btn-danger clean-before"><i class="layui-icon">&#xe640;</i>之前</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="data-table">
            <table class="layui-table">
                <thead>
                    <tr>
                        <th>id</th>
                        <th>发件人</th>
                        <th>收件人</th>
                        <th>投递状态</th>
                        <th>发送时间</th>
                        <th>操作人</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($loglist as $k => $rows): ?>
                        <tr tid="<?=$rows['id']?>">
                            <td><?= $k + 1 ?></td>
                            <td><?= $rows['sender'] ?></td>
                            <td><?= $rows['receiver'] ?></td>
                            <td>
                                <?php if ($rows['isok'] == 1): ?>
                                    <span class="layui-badge layui-bg-cyan">Success</span>
                                <?php else: ?>
                                    <span class="layui-badge layui-bg-orange">Failed</span>
                                <?php endif; ?>
                            </td>
                            <td><?= $rows['create_time'] ?></td>
                            <td><?= $rows['username'] ?></td>
                        </tr>

                    <?php endforeach; ?>

                </tbody>
            </table>
        </div>
    </div>
</body>
<script>
    layui.use(['form', 'laypage'], function () {
        var form = layui.form,
                laypage = layui.laypage;
        $(".clean-today").click(function(){
            let url = "<?=site_url('task/cleanlog')?>";
            let jsonData = {
                'cleantype':1
            };
            $.post(url,jsonData,function(redata){
                if(redata.errno=='666'){
                    layer.msg(redata.error);
                    setTimeout(function(){
                        window.location.href = "<?=site_url('task/log')?>";
                    },3000);
                } else {
                    layer.msg(redata.error);
                }
            },'json')
        })
        $(".clean-before").click(function(){
            let url = "<?=site_url('task/cleanlog')?>";
            let jsonData = {
                'cleantype':2
            };
            $.post(url,jsonData,function(redata){
                if(redata.errno=='666'){
                    layer.msg(redata.error);
                    setTimeout(function(){
                        window.location.href = "<?=site_url('task/log')?>";
                    },3000);
                    
                } else {
                    layer.msg(redata.error);
                }
            },'json')
        })

    });
</script>

</html>